import React, {Component} from 'react';
import { Tabs } from "antd";
import TabContent from "./component/tabOneContent";
import {
    apiPetCheckEcho,
} from '@/request/petDistinguish/distinguish';

const { TabPane } = Tabs;
class Index extends Component {
    state = {
        defaultActiveKey: '1',
        count: 0
    }
    componentDidMount() {
        apiPetCheckEcho().then(res=>{
            console.log(res)
            if (res.code === 0){
                this.setState({
                    count: res.data
                })
            }
        })
    }
    onTabChange(e){
        this.setState({
            defaultActiveKey: e
        })
    }
    render() {
        let {
            defaultActiveKey,
            count
        } = this.state;
        return (
            <div className="p-layout-box commodity-examine">
                <Tabs activeKey={defaultActiveKey} type="card" size={'small'} onChange={(e) => this.onTabChange(e)}>
                    <TabPane tab="全部" key="1" forceRender>
                        <TabContent history={this.props.history} type={1}/>
                    </TabPane>
                    <TabPane tab={"待鉴别("+count+")"} key="2" forceRender>
                        <TabContent history={this.props.history} type={0}/>
                    </TabPane>
                </Tabs>
            </div>
        );
    }
}

export default Index;
